package com.canomo.modules.sys.entity;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import java.io.Serializable;

/**
 * <p>
 *  用户表
 * </p>
 *
 * @author xiaoj
 * @since 2018-07-12
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "uid", type = IdType.ID_WORKER)
    @JsonSerialize(using=ToStringSerializer.class) //序列化时把long转换成String，防止精度丢失
    private Long uid;

    /**
     * 名称
     */
    private String name;

    /**
     * 手机
     */
    private String phone;

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Override
    protected Serializable pkVal() {
        return this.uid;
    }

    @Override
    public String toString() {
        return "User{" +
                "uid=" + uid +
                ", name=" + name +
                ", phone=" + phone +
                "}";
    }
}
